package com.ch01;

/**
 * 接口设计，单一责任制
 * @author muhan
 *
 */
@FunctionalInterface
interface Interface1{
	int doubleNum(int i);
	default int add(int x,int y){
		return x+y;
	}
}
public class LambdaDemo {
	public static void main(String[] args) {
		//1
		Interface1 i1 = (i)->i*2;
		System.out.println(i1.add(10, 23));
		//System.out.println(i1.doubleNum(50));
		System.out.println(i1.doubleNum(50));
		//2
		Interface1 i2 = i->i*2;
		//3
		Interface1 i3 = (int i)->i*2;
		//4
		Interface1 i4 = (int i)->{
			System.out.println("---------------");
			return i*2;
		};
	}
}
